<?php


namespace App\Http\ModelDao\ClassTransactionDetail;

use App\Enum\ClassListHistoryEnum;

class ClassTransactionDetailDao
{
     /**
     * 响应数据格式转换为序号数组
     *
     * @param $result
     *
     * @return array
     */
    public static function numberResult($result)
    {
        $data = [];
        foreach ($result as $val) {

            $data[] = [
              $val->city_name,
              $val->ledger_subject_name,
              $val->class_id,
              $val->class_name,//班级名称
              $val->create_date,//汇总时间
              $val->pay_num,
              $val->pay_amt,
              $val->pay_fee,
              $val->refund_num,
              $val->refund_amt,
              $val->refund_fee,
              $val->class_netting,//当日班级轧差净额
              $val->account_netting,//当日账户轧差净额
              self::Result($val->result),
            ];
        }
        return $data;
    }
    /*
     * 获取招行接口同步结果映射: SUCCESS 成功、FAILURE 失败、UNKNOW 未知、ING 推送中、WAIT 未推送
     */
    private static function Result($result){
        return ClassListHistoryEnum::$push_status[$result];
    }
}
